{% extends "commons/base.html" %}
{% block title %}注册{% endblock %}
{% block css %}
<link rel="stylesheet" href="{{url_for('static', filename='css/register.css')}}">
{% endblock %}
{% block content %}
    <div class="form-content panel panel-default">
        <div class="panel-heading">用户注册</div>
        <div class="panel-body">
            <form action="{{url_for('user.register')}}" method="post" class="form-horizontal">
                {{form.hidden_tag()}}
                <div class="form-group">
                    {{form.username.label(class="col-sm-3 control-label")}}
                    <div class="col-sm-6">
                        {{form.username(class="form-control")}}
                    </div>
                    <div class="col-sm-3">
                        {% if get_flashed_messages()[0] and  get_flashed_messages()[0].username and get_flashed_messages()[0].username[0] %}
                            <p class="form-control-static text-danger">
                                {{get_flashed_messages()[0].username[0]}}
                            </p>
                        {% endif %}
                    </div>
                </div>
                <div class="form-group">
                    {{form.email.label(class="col-sm-3 control-label")}}
                    <div class="col-sm-6">
                        {{form.email(class="form-control")}}
                    </div>
                    <div class="col-sm-3">
                        {% if get_flashed_messages()[0] and  get_flashed_messages()[0].email and get_flashed_messages()[0].email[0] %}
                            <p class="form-control-static text-danger">{{get_flashed_messages()[0].email[0]}}</p>
                        {% endif %}
                    </div>
                </div>
                <div class="form-group">
                    {{form.password.label(class="col-sm-3 control-label")}}
                    <div class="col-sm-6">
                        {{form.password(class="form-control")}}
                    </div>
                    <div class="col-sm-3">
                        {% if get_flashed_messages()[0] and get_flashed_messages()[0].password and get_flashed_messages()[0].password[0] %}
                            <p class="form-control-static text-danger">{{get_flashed_messages()[0].password[0]}}</p>
                        {% endif %}
                    </div>
                </div>
                <div class="form-group">
                    {{form.confirmPassword.label(class="col-sm-3 control-label")}}
                    <div class="col-sm-6">
                        {{form.confirmPassword(class="form-control")}}
                    </div>
                    <div class="col-sm-3">
                        {% if get_flashed_messages()[0] and get_flashed_messages()[0].confirmPassword and get_flashed_messages()[0].confirmPassword [0] %}
                            <p class="form-control-static text-danger">{{get_flashed_messages()[0].confirmPassword [0]}}</p>
                        {% endif %}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-9 col-sm-offset-3">
                        <p class="form-control-static">
                            <a href="{{url_for('user.login')}}">已有账户，前往登录</a>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-9 col-sm-offset-3">
                        {{form.submit(class="btn btn-primary")}}
                    </div>
                </div>
            </form>
        </div>
    </div>
{% endblock %}